﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class UserControl_tin_tuc_danh_sach_chuyen_muc : System.Web.UI.UserControl
{
    protected string strClassName = "UserControl_tin_tuc_danh_sach_chuyen_muc";
    protected string strChuyenMuc;
    protected string strTrang;
    protected string strTenCM;


    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            xGetParam();
            xTitle();
        }
    }

    /// <summary>
    /// Lấy tên chuyên mục tin tức set Title
    /// Author: NguyenTV
    /// </summary>
    private void xTitle()
    {
        DataTable dtCM = clsChuDeTinTuc.fncGetCM_BY_nameEN(OsPortal.oStringHelper.fncCnvNullToString(strChuyenMuc));
            if(dtCM.Rows.Count > 0)
            {
                strTenCM = dtCM.Rows[0]["cd_ten"].ToString();
            }
            else{strTenCM = "Tin Tức";}
    }

    /// <summary>
    /// Lấy danh sách paramaster trên url
    /// Author: NguyenTV
    /// CreateDate: 09/09/2013
    /// </summary>
    private void xGetParam()
    {
        try
        {
            strChuyenMuc = clsCommon.fncGetRoute(this.Page, "param1");
            strTrang = clsCommon.fncGetRoute(this.Page, "param2");
            //
            if (string.IsNullOrEmpty(strTrang)) strTrang = "1";

            hd_ChuyenMuc.Value = strChuyenMuc;
            hd_iCurrPage.Value = strTrang;
        }
        catch (Exception ex)
        {
            OsPortal.oFileHelper.WriteLogErr(strClassName, "xGetParam", ex.ToString());
        }
    }

}